(function ($) { $.fn.clickToggle = function (func1, func2) { var funcs = [func1, func2]; this.data('toggleclicked', 0); this.click(function () { var data = $(this).data(); var tc = data.toggleclicked; $.proxy(funcs[tc], this)(); data.toggleclicked = (tc + 1) % 2; }); return this; }; }(jQuery)); (function ($) { $().ready(function () { $(".Title-Marsad-Main .banner-header").each(function () { if (!$(this).text().trim().length) { $(this).addClass("hidden"); } }); var noOfItems = 6; noOfItems++; var menulength = $('#example > li').length; var items = menulength - noOfItems; if (menulength > noOfItems) { var items = menulength - noOfItems; console.log(-items); var x = $('#example > li').slice(-items); $('#example').append("